package de.lot.action;

import de.lot.model.ProgramGoal;
import java.util.Arrays;
import java.util.List;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;

/**
 * Represents a list auf ProgramGoals and gets it from the database.
 *
 * @author Stefan Kohler <kohler.stefan@gmail.com>
 */
@Name("programGoalList")
public class ProgramGoalList extends EntityQuery {

    private ProgramGoal programGoal = new ProgramGoal();
    private static final String[] RESTRICTIONS = {
        "lower(programGoal.number) like concat(lower(#{programGoalList.programGoal.number}),'%')",
        "lower(programGoal.description) like concat(lower(#{programGoalList.programGoal.description}),'%')",
        "lower(programGoal.language) like concat(lower(#{programGoalList.programGoal.language}),'%')",};

    /**
     * The search String for all programGoals
     *
     * @return String
     */
    @Override
    public String getEjbql() {
        return "select programGoal from ProgramGoal programGoal";
    }

    @Override
    public List<String> getRestrictions() {
        return Arrays.asList(RESTRICTIONS);
    }

    @Override
    public Integer getMaxResults() {
        return 25;
    }

    public ProgramGoal getProgramGoal() {
        return programGoal;
    }
}
